package com.west.page;

import com.west.utils.ScannerChoice;

public class MainPage extends ScannerChoice{
	
	public static void main(String[] args) {
		mainpage();
	}
	
	/**
	 * 主界面
	 */
	public static void mainpage() {
		System.out.println("********************\n");
		System.out.println("\t 1.商品维护\n");
		System.out.println("\t 2.前台收银\n");
		System.out.println("\t 3.商品管理\n");
		System.out.println("********************\n");
		System.out.println("\n请输入选项或者按0退出");
		do {
			String choice = ScannerInfoString();
			String regex = "[0-3]";//正则表达式
			if(choice.matches(regex)) {
				int info=Integer.parseInt(choice);
				switch(info) {
				case 0:
					System.out.println("您已退出系统");
					System.exit(1);
					break;
				case 1:
					MaintenancePage();
					break;
				case 2:
					MaintenancePage();
					break;
				case 3:
					MaintenancePage();
					break;
				default:
					break;
				}
			}
			System.err.println("输入有误！");
			System.out.println("重新选择或者按0退出");
		}while(true);
	}
	
	/**
	 * 商品维护界面
	 */
	public static void MaintenancePage() {
		System.out.println("***************************\n");
		System.out.println("\t 1.添加商品\n");
		System.out.println("\t 2.更改商品\n");
		System.out.println("\t 3.删除商品\n");
		System.out.println("\t 4.查询商品\n");
		System.out.println("\t 5.显示所有商品\n");
		System.out.println("***************************");
		System.out.println("\n请输入选项,或者按 0 返回上一级菜单");
		
		do {
			String choice = ScannerInfoString();
			String regex = "[0-5]"; 
			if(choice.matches(regex)) {
				int info = Integer.parseInt(choice);
				switch(info) {
				case 0:
					mainpage();
					break;
				case 1:
					break;
				case 2:
					break;
				case 3:
					break;
				case 4:
					break;
				case 5:
					break;
				default:
					break;
				}
			}
			System.err.println("!输入有误!");
			System.out.println("重新输入或按 0 返回上一级菜单.");
		}while(true);
	}
	
	/**
	 * 前台收银登录界面
	 */
	public static void checkLogPage() {
		System.out.println("\n*******欢迎使用超市购物管理系统*******\n");
		System.out.println("\t 1.登录系统\n");
		System.out.println("\t 2.退出\n");
		System.out.println("-----------------------------");
		System.out.println("请输入选项,或者按 0 返回上一级菜单.");
	}
	
	
	
	
	
	
	
	
	
	
	
}
